import java.sql.*;
import java.util.ResourceBundle;
public class Main {
    public static void main(String[] args) {

        ResourceBundle bundle = ResourceBundle.getBundle("jdbc");
        String driver = bundle.getString("driver");
        String user = bundle.getString("user");
        String url = bundle.getString("url");
        String password = bundle.getString("password");


        Connection connection = null;
        Statement statement = null;
        // 这里getboundle 的方法的参数就是配置文件的文件名,不需要后缀名

        try {
            // 注册驱动的另一种方式.

            // 这里的字符串要记住

            Class.forName(driver);

            //1.获取链接

            connection = DriverManager.getConnection(url,user,password);
            //2.创建链接对象
            statement = connection.createStatement();
            // 3.执行mysql语句
            String sql = "update emp set sal = sal *0.5 where sal = 3200";

            int ret = statement.executeUpdate(sql);
            System.out.println(connection);
            System.out.println(ret);

            //4.对查询结果级操作
        }
        catch (SQLException e)
        {
            e.printStackTrace();
        }
        catch (ClassNotFoundException  e)
        {
            e.printStackTrace();
        }

            finally {

            // 5. 释放资源

        }


    }
}